Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTC-2794: Only owner or admin can use mutate dataset endpoints #512

Merged
merged 11 commits into from
May 9, 2024

Conversation

dmannarino
Copy link
Member

@dmannarino dmannarino commented May 8, 2024

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). Don't request your master!
  • Make sure you are making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Check the commit's or even all commits' message styles matches our requested structure.
  • Check your code additions will fail neither code linting checks nor unit test.

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this introduce a breaking change?

  • Yes
  • No

Other information

@dmannarino dmannarino changed the base branch from master to feature/data_manager May 8, 2024 19:24
Copy link
Collaborator

@danscales danscales left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be easier to read once Justin's changes are merged into feature/data_manager (since this current diff includes all of Justin's changes), but yes, your changes look good to me. Thanks for writing the fail and success test cases.

I assume you purposely skipped adding a test for update_dataset, since it is so similar to delete_dataset? Seems ok to not add tests for update_dataset.

async def get_owner(
dataset: str = Depends(dataset_dependency), user: User = Depends(get_manager)
) -> User:
dataset_row: ORMDataset = await datasets.get_dataset(dataset)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a """ .... """ comment line describing the function above this line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do, thanks! Also, I'm adding more tests.

@dmannarino dmannarino marked this pull request as ready for review May 9, 2024 02:11
@codecov-commenter
Copy link

codecov-commenter commented May 9, 2024

Codecov Report

Attention: Patch coverage is 57.14286% with 15 lines in your changes are missing coverage. Please review.

Project coverage is 81.87%. Comparing base (3843ed5) to head (99ebb6a).

Files Patch % Lines
app/authentication/token.py 38.46% 8 Missing ⚠️
app/routes/authentication/authentication.py 14.28% 6 Missing ⚠️
app/utils/rw_api.py 66.66% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@                   Coverage Diff                    @@
##           feature/data_manager     #512      +/-   ##
========================================================
+ Coverage                 81.84%   81.87%   +0.03%     
========================================================
  Files                       125      125              
  Lines                      5551     5562      +11     
========================================================
+ Hits                       4543     4554      +11     
  Misses                     1008     1008              
Flag Coverage Δ
unittests 81.87% <57.14%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dmannarino dmannarino merged commit 1796f60 into feature/data_manager May 9, 2024
1 of 2 checks passed
@dmannarino dmannarino deleted the gtc_2794_protect_dataset_endpoints branch May 9, 2024 18:22
Copy link
Member

@solomon-negusse solomon-negusse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, great test coverage!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants